'''
@author: rocio
'''
from estados.New import New


class PCB():
    def __init__(self, aProgram, pid):
        self.program = aProgram
        self.id = pid
        self.currentInstruction = 0
        self.state= New()
    
    #Getter
    def getProgram(self):
        return self.program
    def getId(self):
        return self.id
    def getCurrentInstruction(self):
        return self.currentInstruction
    def getInstruction(self):
        return self.program.getInstructions()[self.currentInstruction]
    def getPriority(self):
        return self.program.getPriority()
    def getState(self):
        return self.state.getName()
    
    #setter
     
    def setState(self, state):
        self.state = state
    def aumentarInstruction(self):
        self.currentInstruction += 1
    def restarInstruction(self):
        self.currentInstruction -= 1

    def lenInstructions(self):
        return self.program.lenInstructions()
    #metodos
    def isFinish(self):
        return self.lenInstructions() == self.getCurrentInstruction()
            